package org.example.javaee_demo1.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.javaee_demo1.pojo.User;

import java.util.List;
@Mapper
public interface UserMapper {

    @Select("select * from users where username=#{username} and password=#{password}")
    boolean isexistname( String username,String password);


    @Select("select *from users")
    List<User> getUser();

    @Insert("insert into users(username, password, name, email, gender, address, birthday, register_time) values(#{username}, #{password}, #{name}, #{email}, #{gender}, #{address}, #{birthday}, NOW())")
    boolean addUser(User user);


    @Delete("delete from users where user_id = #{id}")
    boolean deleteUser(Integer id);

    @Update("update users set username=#{username}, password=#{password}, name=#{name}, email=#{email}, gender=#{gender}, address=#{address}, birthday=#{birthday} where user_id=#{userId}")
    boolean updateUser(User user);
}
